//
// Created by Jisam on 2024/7/21.
//
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

void solve() {
    i64 n;
    cin >> n;

    int c = __builtin_popcountll(n);
    if (c == 1) {
        cout << 1 << "\n";
        cout << n << "\n";
    } else {
        cout << c + 1 << "\n";
        for (int i = 59; i >= 0; i--) {
            if (n >> i & 1) {
                cout << (n ^ (1LL << i)) << " ";
            }
        }
        cout << n << "\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}